<?php


namespace app\admin\model;


use think\Model;

/**
 * Class HtnsActivity
 * @package app\admin\model
 * @desc 海淘女神-基站-快递公司表
 */
class HtnsExpress extends Model
{
    protected $connection = 'htns';
    protected $table = 'eb_express';

    // 获取快递公司列表
    public function getList()
    {
        $where['is_show'] = 1;
        $res = self::where($where)->select()->toArray();
        return $res;
    }

    /**
     * @desc 获取物流状态
     * @param int $oid 订单表id
     */
    public function getStatus($oid)
    {
        $status = '';
        $order = HtnsOrder::find($oid);
        if($order['paid'] && in_array($order['status'] , [0,4]) && !$order['is_del']){
            $status = '待发货';
        }elseif ($order['paid'] && $order['status']==1 && !$order['is_del'] && $order['delivery_id']){
            $status = '已发货';
        }elseif ($order['paid'] && $order['status']>=2 && !$order['is_del']){
            $status = '已收货';
        }
        return $status;
    }
}